//! # lgrep
//! A simple grep tool  
//! Contains the core functionality of the grep tool  
//! Contains some common functions  

pub mod common;
pub mod app;

pub use common::arg_parser;
pub use common::utils;

#[cfg(test)]
mod tests { 
    use super::*;

    #[test]
    fn one_result() {
        let query = "duct";
        let contents = "\
Rust:
safe, fast, productive.
Pick three.";

        assert_eq!(
            vec!["safe, fast, productive."],
            app::search(query, contents)
        );
    }

    #[test]
    fn case_insensitive() {
        let query = "rUsT";
        let contents = "\
Rust:
safe, fast, productive.
Pick three.
Trust me.";

        assert_eq!(
            vec!["Rust:", "Trust me."],
            app::search_case_insensitive(query, contents)
        );
    }
}